package com.qidian.buy.goods.controller;

import com.qidian.buy.common.pojo.BuyResult;
import com.qidian.buy.goods.service.IItemService;
import com.qidian.buy.goods.vo.ItemVO;
import com.qidian.buy.pojo.Item;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 戴着假发的程序员
 * @company 起点编程
 * @date 2024/7/17 14:43
 */
@CrossOrigin
@RestController
@RequestMapping("/item")
public class ItemController {
    @Autowired
    private IItemService itemService;

    @PostMapping("/save")
    public BuyResult save(@RequestBody ItemVO vo){
        return itemService.saveItem(vo);
    }

    @GetMapping("/list")
    public BuyResult list(Item item,@RequestParam(defaultValue = "1")int page,@RequestParam(defaultValue = "10")int limit){
        return itemService.queryByPage(page,limit,item);
    };
}
